﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace TM.Weixin.MP.Commons.Extensions
{
    public static class StringExtension
    {
        public static DateTime ToDate(this object souce)
        {
            DateTime result = DateTime.MinValue;
            if (DateTime.TryParse(souce.ToString(), out result))
            {
                result = Convert.ToDateTime(souce);
            }

            return result;
        }

        public static int ToInt(this object souce)
        {
            return Convert.ToInt32(souce);
        }
    }
}